= simple_form_for parent? ? [parent, resource] : resource do |f|
  .row-fluid
    = f.input :title

  .row-fluid
    .span6
      = f.input :file, :as => :file
    .span6
      = f.input :code, :collection => attachment_code_collection

    - if parent?
      - if parent
        - f.object.reference = parent
        = f.input :reference_id, :as => :hidden
        = f.input :reference_type, :as => :hidden
      - else
        = f.input :reference, :collection => parent_class.all

  = f.button :submit
